<?php
session_start();
require_once '../lib/sql.utils.php';
$_SESSION['data'] = 'displayFormAddBook';
$sql_util = new SqlUtils();
?>

<div class="menu">
	Quản lý Sách > Thêm đầu Sách
</div>
<hr />
<form id="myForm" name="myForm" method="post" enctype="multipart/form-data" action="service/process_add_book.php">
	<label for="name">Tên Sách :</label>
	<input type="text" id="name" name="name" placeholder="book store name" />
	<span id="check-name"></span>
	<br />
	<label for="select-cate">Thuộc danh mục : </label>
	<select name="select-category-detail" id="select-category-detail">
		<?php
			$result = $sql_util -> getRows('SELECT * FROM categorydetails');
			for ($i=0; $i < count($result); $i++) {
				echo '<option value="'.$result[$i]['categoryDetailId'].'" >'.$result[$i]['categoryDetailName']. '</option>';
			}
		?>
	</select>
	<br />
	<label for="page-numb">Số trang :</label>
	<input type="text" id="page-numb" name="page-numb" placeholder="Page numb" />
	<span id="check-page-numb"></span>
	<br />
	<label for="upload">Bìa sách :</label>
	<input type="file" name="upload" id="upload" />
	<span id="check-image"></span>
	<br />
	<label for="select-author">Của tác giả : </label>
	<select name="select-author" id="select-author">
		<?php
			$result = $sql_util -> getRows('SELECT * FROM authors');
			for ($i=0; $i < count($result); $i++) {
				echo '<option value="'.$result[$i]['authorId'].'" >'.$result[$i]['authorName']. '</option>';
			}
		?>
	</select>
	<br/>
	<label for="select-publisher">Nhà xuất bản : </label>
	<select name="select-publisher" id="select-publisher">
		<?php
			$result = $sql_util -> getRows('SELECT * FROM publishers');
			for ($i=0; $i < count($result); $i++) {
				echo '<option value="'.$result[$i]['publisherId'].'" >'.$result[$i]['publisherName']. '</option>';
			}
		?>
	</select>
	<br/>
	<label for="select-book-store">Có tại hiệu sách : </label>
	<select name="select-book-store" id="select-book-store">
		<?php
			$result = $sql_util -> getRows('SELECT * FROM bookstores');
			for ($i=0; $i < count($result); $i++) {
				echo '<option value="'.$result[$i]['bookStoreId'].'" >'.$result[$i]['bookStoreName']. '</option>';
			}
		?>
	</select>
	<br/>
	<label for="size">Cỡ sách :</label>
	<input type="text" name="size" id="size" placeholder="Book Size" />
	<span id="check-size"></span>
	<br />
	<label for="price">Giá bán :</label>
	<input type="text" name="price" id="price" placeholder="Price" />
	<span id="check-price"></span>
	<br />
	<label for="discount">Chiết khấu :</label>
	<input type="text" name="discount" id="discount" placeholder="Discount" />
	<span id="check-discount"></span>
	<br />
	<label for="description">Giới thiệu :</label>
	<textarea id="description" name="description" rows="10" cols="70"></textarea>
	<span id="check-description"></span>
	<br />
	<input type="submit" id="button" name="button" value="Submit"/>
</form>